package cn.stylefeng.guns.modular.storage.mapper;

import cn.stylefeng.guns.modular.storage.entity.StorageOut;
import cn.stylefeng.guns.modular.storage.model.params.StorageOutParam;
import cn.stylefeng.guns.modular.storage.model.result.StorageOutResult;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 拣货单表 Mapper 接口
 * </p>
 *
 * @author hu
 * @since 2019-07-11
 */
public interface StorageOutMapper extends BaseMapper<StorageOut> {

    /**
     * 获取列表
     *
     * @author hu
     * @Date 2019-07-11
     */
    List<StorageOutResult> customList(@Param("paramCondition") StorageOutParam paramCondition);

    /**
     * 获取map列表
     *
     * @author hu
     * @Date 2019-07-11
     */
    List<Map<String, Object>> customMapList(@Param("paramCondition") StorageOutParam paramCondition);

    /**
     * 获取分页实体列表
     *
     * @author hu
     * @Date 2019-07-11
     */
    Page<StorageOutResult> customPageList(@Param("page") Page page, @Param("paramCondition") StorageOutParam paramCondition
    		, @Param("condition") String condition, @Param("deptId")Long deptId, @Param("operateId")Long operateId);
    
    List<StorageOutResult> findPageBySpecNew(@Param("paramCondition") StorageOutParam paramCondition, @Param("condition") String condition,@Param("deptId")Long deptId);

    /**
     * 查询工人拣货单地址列表
     *
     * @author wz
     * @Date 2019-07-11
     */
    Page<StorageOutResult> customPageListWork(@Param("page") Page page, @Param("paramCondition") StorageOutParam paramCondition, @Param("condition") String condition,@Param("deptId")Long deptId);


    /**
     * 获取分页map列表
     *
     * @author hu
     * @Date 2019-07-11
     */
    Page<Map<String, Object>> customPageMapList(@Param("page") Page page, @Param("paramCondition") StorageOutParam paramCondition);

    StorageOut findLastOne();

	Page<StorageOutResult> findPageByGet(@Param("page")Page pageContext, @Param("paramCondition")StorageOutParam storageOutParam, @Param("condition")String condition, @Param("deptId")Long deptId);

	List<StorageOutResult> findListBySpec(@Param("paramCondition")StorageOutParam param, @Param("deptId")Long deptId);

    /**
     * app通过地址id 收货单位id 查询订单列表
     * @param storageOutParam
     * @param condition
     * @param deptId
     * @return
     */
	List<StorageOutResult>  findPageByGetApp(@Param("paramCondition")StorageOutParam storageOutParam, @Param("deptId")Long deptId);

    /**
     * app通过地址id 收货单位id 查询订单列表
     * @param deptId
     * @return
     */
    List<StorageOutResult>  findPageByGetReview(@Param("paramCondition")StorageOutParam storageOutParam, @Param("deptId")Long deptId);


    /**
     * app工人通过地址id 收货单位id 查询订单列表
     * @param storageOutParam
     * @param deptId
     * @return
     */
    List<StorageOutResult>  findPageByGetAppWork(@Param("paramCondition")StorageOutParam storageOutParam, @Param("deptId")Long deptId, @Param("operateId")Long operateId);


    /**
     * 出库审核查询地址
     *
     * @author wz
     * @Date 2019-08-08
     */
    Page<StorageOutResult> findPageBySpecReview(@Param("page") Page page, @Param("paramCondition") StorageOutParam paramCondition,@Param("deptId")Long deptId);

	StorageOutResult findBySpec(@Param("paramCondition")StorageOutParam param);

	/**
	 * 拣货单查询
	 * @param pageContext
	 * @param param
	 * @param condition
	 * @param deptId
	 * @return
	 */
	Page<StorageOutResult> querylistPageBySpec(@Param("page")Page pageContext, @Param("paramCondition")StorageOutParam param, @Param("condition")String condition, @Param("deptId")Long deptId
			,@Param("outCustomerId")Long outCustomerId,@Param("singleOutTime")String singleOutTime,@Param("operateId")Long operateId);

	StorageOutResult getPrintstorageOut(@Param("paramCondition")StorageOutParam param);

	StorageOutResult findBySpecs(@Param("paramCondition")StorageOutParam param);

	List<StorageOutResult> findListByMakeSpec(@Param("paramCondition")StorageOutParam param);

	List<StorageOutResult> findPageBySpecWorkNew(@Param("paramCondition")StorageOutParam param, @Param("condition")String condition, @Param("deptId")Long deptId, @Param("operateId")Long operateId);

	List<StorageOutResult> findPageByGetApp2(@Param("paramCondition")StorageOutParam sop, @Param("deptId")Long deptId);

	List<StorageOutResult> findPageBySpecWorkNewexamin(@Param("paramCondition")StorageOutParam storageOutParam, @Param("condition")String condition, @Param("deptId")Long deptId,@Param("operateId")Long operateId);

	List<StorageOutResult> findPageByGetAppWorkexamin(@Param("paramCondition")StorageOutParam p, @Param("deptId")Long deptId,@Param("operateId")Long operateId);

	List<StorageOutResult> findListByStrs(@Param("paramCondition")StorageOutParam param, @Param("strs")String[] strs);


    StorageOutResult findByUserAndStorageOutNumber(@Param("userId") Long userId, @Param("storageOutNumber") String storageOutNumber);

	void updateUserByStorageOutNumber(@Param("assignee") Long userId, @Param("assigneename") String name, @Param("date") Date date, @Param("storageOutNumber") String storageOutNumber);
}
